package dao;

import java.sql.Types;

import org.hibernate.HibernateException;
import org.hibernate.dialect.SQLServer2008Dialect;

public class UnicodeSQLServerDialect extends SQLServer2008Dialect {
	public UnicodeSQLServerDialect() {
		super();
		registerColumnType(Types.VARCHAR, "nvarchar($1)");
		registerColumnType(Types.CLOB, "nvarchar(max)");
	}

	public String getTypeName(int code, int length, int precision, int scale) throws HibernateException {
		if (code != 2005) {
			return super.getTypeName(code, length, precision, scale);
		} else {
			return "ntext";
		}
	}
}
